<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no,minimal-ui">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="apple-mobile-web-app-title" content="阿福易购">
    <meta content="telephone=no" name="format-detection" />
    <meta content="email=no" name="format-detection" />
    <!-- uc、qq浏览器 -->
    <meta name="screen-orientation" content="portrait">
    <meta name="full-screen" content="yes">
    <meta name="browsermode" content="application">
    <meta name="x5-orientation" content="portrait">
    <meta name="x5-fullscreen" content="true">
    <meta name="x5-page-mode" content="app">
    <meta name="HandheldFriendly" content="true">
    <meta name="MobileOptimized" content="320">
    <meta name="keywords" content="{{$SEO['keywords']}}"/>
    <meta name="description" content="{{$SEO['description']}}"/>
    <meta name="csrf-token" content="{{ csrf_token() }}" />
    <title>修改密码_{{$SEO['title']}}</title>
    <link rel="stylesheet" href="{{ asset('/build/css/app.min.css') }}">
</head>
<body ontouchstart="">
<header class="ui-header ui-header-stable  af-header">
    <ul class="ui-row-flex">
        <li class="ui-col ui-flex ui-flex-pack-start">
            <a ontouchstart="window.history.back();"><i class="ui-icon-return"></i></a>
        </li>
        <li class="ui-col ui-flex ui-flex-pack-center">
            <h1>修改密码</h1>
        </li>
        <li class="ui-col ui-flex ui-flex-pack-end">
        </li>
    </ul>
</header>
<div class="ui-container">
    <section class="ui-form-login">
        <form id="form" action="/setting/resetOk" method="post" novalidate>
            <input id="userId" type="hidden" value="{{$user->id}}">
            <div class="ui-form-item ui-form-item-pure ui-border">
                <input id="pwd" type="password" name="pwd" data-reg="^[\S]{6,20}$" placeholder="请输入原密码" required data-reg-msg="原密码输入有误">
                <a href="#" class="ui-icon-close"></a>
            </div>
            <div class="ui-form-item ui-form-item-pure ui-form-item-switch ui-border">
                <input id="newPwd" type="password" name="newPwd" data-reg="^[\S]{6,20}$" placeholder="请设置6-20位新密码" required data-reg-msg="原密码输入有误">
                <a href="#" class="ui-icon-close"></a>
                <label class="ui-switch ui-switch-primary">
                    <input type="checkbox">
                </label>
            </div>
            <div class="ui-form-item ui-form-item-pure ui-form-item-switch ui-border">
                <input id="rePwd" type="password" name="rePwd" data-reg="^[\S]{6,20}$" placeholder="请再次输入新密码" required>
                <a href="#" class="ui-icon-close"></a>
                <label class="ui-switch ui-switch-primary">
                    <input type="checkbox">
                </label>
            </div>
            <button class="ui-btn-lg ui-btn-primary" type="submit">确认修改</button>
        </form>

    </section>
</div>

<script src="{{ asset('/build/lib/zepto.min.js') }}"></script>
<script src="{{ asset('/build/js/frozen.js') }}"></script>
<script src="{{ asset('/build/js/app.min.js') }}"></script>
<script>
    $(function () {
        var form=$('#form');
        var switchItem=form.find('.ui-switch');
        var pwd=form.find('#pwd');
        var newPwd=form.find('#newPwd');
        var rePwd=form.find('#rePwd');

        //显示密码
        switchItem[0]&&TogglePwd(switchItem);

        form.on('submit',function (e) {
            e.preventDefault();
            var isOK= RegForm(form);
            var equalTopwd=pwd.val()===newPwd.val();
            var equalTo=rePwd.val()===newPwd.val();
            if(!isOK) return false;


            if(isOK&&!equalTo) {
                topTip('两次输入的密码不一致！',{type:'warn'});
                return false;
            }

            MyAjax(form.attr('action'),'post',form.serialize(),function (res) {
                topTip(res.message);
                setTimeout(function () {
                    Jump('/user/login');
                },3000);
            });


        });
    })
</script>

</body>
</html>